import {HttpClient} from '@angular/common/http';
import {Injectable} from '@angular/core';
import {Observable} from "rxjs/Observable";

@Injectable()
export class CollectionListProvider {
    public infoUrl = '/favorite/v1/info_favorite';
    public msgUrl='/favorite/v1/msg_favorite';

    constructor(public http: HttpClient) {
    }

    // 获取资讯藏列表
    getInfoCollectList():Observable<any>{
        return this.http.get(this.infoUrl);
    }

    // 取消资讯收藏
    cancelCollect(contentId):Observable<any>{
        return this.http.delete(this.infoUrl+'/'+contentId,{responseType: "text"});
    }

    // 获取消息收藏列表
    getMsgCollectList():Observable<any>{
        return this.http.get(this.msgUrl)
    }

    // 取消消息收藏
    cancelCollectMsg(id):Observable<any>{
        return this.http.delete(this.msgUrl+'/'+id,{responseType:'text'})
    }
}
